export default {
	state: {
		isCollapse: false, // 控制左侧菜单折叠收起
		tabsList: [			// 面包屑数据
			{
				path: "/",
				name: "home",
				label: "首页",
				icon: "s-home",
				url: "Home/Home",
			}
		]
	},
	mutations: {			//mutation第一个参数固定传入state
		// 修改菜单折叠
		collapseMenu(state) {
			state.isCollapse = !state.isCollapse
		},
		// 更新面包屑数据
		selectMenu(state, val) {
			if (val.name !== 'home') {
				const index = state.tabsList.findIndex(item => item.name === val.name)
				if (index === -1){
					state.tabsList.push(val)
					// console.log('tabsList',state.tabsList)
				}
			}
		},
		deleteTag(state, val){
			const index = state.tabsList.findIndex(item => item.name === val.name)
			state.tabsList.splice(index, 1)
		}
	},
}
